﻿using System;
using System.Collections.Generic;
using System.Data.Entity.Core;
using System.Data.Entity.Core.Objects;
using System.Linq;
using System.Linq.Expressions;

namespace EntityFrameworkExtension.Interface
{
    public interface IEfContext : IDisposable
    {
        IEfContext Open(string server, string database);
        int CommandTimeout { set; }

        void SaveChanges();

        void AddToObjectList<T>(T item) where T : class;
        List<T> GetObjectList<T>() where T : class;
        void Delete<T>(T item) where T : class;

     


        List<T> GetObjectList<T>(Expression<Func<T, bool>> predicate) where T : class;

        
        List<TEntity> SelectCurrent<TEntity>(
           Expression<Func<TEntity, bool>> filter,
           Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy) where TEntity : class;

        List<TEntity> SelectCurrent<TEntity>() where TEntity : class;
        List<TEntity> SelectCurrent<TEntity>(List<string> includes) where TEntity : class;

        List<TEntity> SelectCurrent<TEntity>(Expression<Func<TEntity, bool>> filter, List<string> includes)
            where TEntity : class;

        void Refresh<TEntity>(RefreshMode storeWins, TEntity entity) where TEntity : class;

        List<TEntity> SelectCurrent<TEntity>(string include) where TEntity : class;
        List<TEntity> SelectCurrent<TEntity>(Expression<Func<TEntity, bool>> filter) where TEntity : class;
        bool IsDirty { get; }

        TEntity First<TEntity>(Expression<Func<TEntity, bool>> filter) where TEntity : class;
        TEntity FirstOrDefault<TEntity>(Expression<Func<TEntity, bool>> filter) where TEntity : class;

        List<TEntity> WhereIn<TEntity, TValue>(Expression<Func<TEntity, TValue>> filter, IEnumerable<TValue> collection) where TEntity : class;



    }
}

